/***
 * 修改表单配置
 */

const operationConfig = {
  title: '商品资料',
  spaceSize: 'default',
  expand: false,
  inline: true,
  layout: 'vertical',
  formData: [
    {
      value: '11',
      prop: 'keyword',
      label: '关键词',
      type: 'text',
      rules: [],
      component: {
        placeholder: '请输入关键词'
      }
    },
    {
      value: '',
      prop: 'id',
      label: 'ID',
      type: 'text',
      flex: 1,
      rules: [
        {
          required: true,
          message: 'Please input email address',
          trigger: 'blur'
        },
        {
          type: 'email',
          message: 'Please input correct email address',
          trigger: ['blur', 'change']
        }
      ],
      component: {
        placeholder: '请输入用户ID'
      }
    },
    {
      value: '',
      prop: 'name',
      label: '城市',
      type: 'select',
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择城市',
          trigger: 'change'
        }
      ],
      options: () => [
        {
          label: '贵州省',
          value: '111'
        },
        {
          label: '广东省',
          value: '222'
        }
      ],
      component: {
        placeholder: '请输入用户ID',
        style: 'min-width: 300px;'
      }
    },
    {
      value: '',
      prop: 'sex',
      label: '性名',
      type: 'radio',
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择你的性别',
          trigger: 'change'
        }
      ],
      options: () => [
        {
          label: '男性',
          value: '1'
        },
        {
          label: '女性',
          value: '0'
        }
      ],
      component: {
        placeholder: '请输入用户ID'
      }
    },
    {
      value: [],
      prop: 'hobby',
      label: '爱好',
      type: 'checkbox',
      flex: 1,
      rules: [
        {
          type: 'array',
          required: true,
          message: '请选择你的爱好',
          trigger: 'change'
        }
      ],
      options: () => [
        {
          label: '钓鱼',
          value: '1'
        },
        {
          label: '打蓝球',
          value: '2'
        },
        {
          label: '踢足球',
          value: '3'
        }
      ],
      component: {
        placeholder: '请输入用户ID'
      }
    },
    {
      value: true,
      prop: 'states',
      label: '状态',
      type: 'switch',
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }
      ]
    },
    {
      value: '',
      prop: 'birthday',
      label: '出生期',
      type: 'date-picker',
      pickerTyep: 'date', //时间类型
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }
      ],
      component: {
        placeholder: '请选择时间'
      }
    },
    {
      value: '',
      prop: 'birthdayTime',
      label: '出生期时间',
      type: 'time-picker',
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }
      ],
      component: {
        placeholder: '请选择时间'
      }
    },
    {
      value: '',
      prop: 'birthdayEnd',
      label: '结束时间',
      type: 'date-picker',
      pickerTyep: 'datetime', //时间类型
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }
      ],
      component: {
        placeholder: '请选择时间'
      },
      shortcuts: [
        {
          text: '当前',
          value: new Date()
        },
        {
          text: '当天',
          value: () => {
            const date = new Date()
            date.setDate(date.getDate() - 1)
            return date
          }
        },
        {
          text: '下周',
          value: () => {
            const date = new Date()
            date.setDate(date.getDate() - 7)
            return date
          }
        }
      ]
    },
    {
      value: '',
      prop: 'treeSelect',
      label: '树状选择器',
      type: 'tree-select',
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }
      ],
      component: {
        placeholder: '请选择时间',
        style: 'min-width: 300px;'
      },
      options: () => {
        const treeSelectData = <unknown>[
          {
            value: '1',
            label: 'Level one 1',
            children: [
              {
                value: '1-1',
                label: 'Level two 1-1',
                children: [
                  {
                    value: '1-1-1',
                    label: 'Level three 1-1-1'
                  }
                ]
              }
            ]
          },
          {
            value: '2',
            label: 'Level one 2',
            children: [
              {
                value: '2-1',
                label: 'Level two 2-1',
                children: [
                  {
                    value: '2-1-1',
                    label: 'Level three 2-1-1'
                  }
                ]
              },
              {
                value: '2-2',
                label: 'Level two 2-2',
                children: [
                  {
                    value: '2-2-1',
                    label: 'Level three 2-2-1'
                  }
                ]
              }
            ]
          },
          {
            value: '3',
            label: 'Level one 3',
            children: [
              {
                value: '3-1',
                label: 'Level two 3-1',
                children: [
                  {
                    value: '3-1-1',
                    label: 'Level three 3-1-1'
                  }
                ]
              },
              {
                value: '3-2',
                label: 'Level two 3-2',
                children: [
                  {
                    value: '3-2-1',
                    label: 'Level three 3-2-1'
                  }
                ]
              }
            ]
          }
        ]
        return treeSelectData
      }
    },
    {
      value: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)],
      prop: 'endTime',
      label: '日期',
      type: 'time-picker',
      flex: 1,
      rules: [
        {
          required: true,
          message: '请选择状态',
          trigger: 'change'
        }
      ],
      component: {
        placeholder: '请选择时间',
        isRange: true,
        arrowControl: true,
        rangeseparator: 'To',
        startPlaceholder: '开时间',
        endPlaceholder: '结束时间',
        style: 'min-width: 300px;'
      }
    }
  ]
}

export default operationConfig
